//app.js

//生产环境配置
let globalDataPro = {
    //通用url
    serverUrl: 'https://iot.landiwulian.com/iot/',
    serverUrlIot: 'https://iot.landiwulian.com/iot/',

    //go项目-通用
    goUrl: 'https://iot.landiwulian.com/go/',

    goProjectRules: 'https://iot.landiwulian.com/go/projectRules/',


    goExcel: 'https://iot.landiwulian.com/go/excel/',


    goDataOpr: 'https://iot.landiwulian.com/go/dataOpr/',


    goDataOprIot: 'https://iot.landiwulian.com/go/dataOpr/',


    goDataReport: 'https://iot.landiwulian.com/go/report/',


    goChart: 'https://iot.landiwulian.com/go/chart/',

    //go-电子工牌
    goCardUrl: 'https://iot.landiwulian.com/go/electronCard/',
    //goCardUrl: 'http://192.168.1.22:8988/go/electronCard/',


    //go项目-nb
    goNb: 'https://iot.landiwulian.com/go/nb/',

    //go-equipment
    goEquipment: 'https://iot.landiwulian.com/go/equipment/',

    //go-UI
    goUI: 'https://iot.landiwulian.com/go/ui/',


    goPersonCenter: 'https://iot.landiwulian.com/go/ui/',


    //nb项目url
    nbUrl: 'https://iot.landiwulian.com/iot/nb/',

    //equipment项目url
    equipmentUrl: 'https://iot.landiwulian.com/iot/equipment/',


    equipmentUrlIot: 'https://iot.landiwulian.com/iot/equipment/',

    healthLog: 'https://iot.landiwulian.com/wristband/',

    pythonEffectiveDetail: 'https://iot.landiwulian.com/wristband/work/',

    sendInstruction: 'https://iot.landiwulian.com/wristband/',

    //获取token地址
    tokenUrl: 'https://iot.landiwulian.com/oauth/token',

    //authority项目url
    authorityUrl: 'https://iot.landiwulian.com/iot/authority/',

    //wechat项目url
    wechatUrl: 'https://iot.landiwulian.com/iot/wechat/',

    //report项目url
    reportUrl: 'https://iot.landiwulian.com/report/',

    sendMessageTTS: 'https://iot.landiwulian.com/test/wristband/',

    storage:'https://iot.landiwulian.com/go/material/',
  //集体任务和巡检任务
  task:"https://iot.landiwulian.com/go/task/",
  //用友相关
  yy:'https://iot.landiwulian.com/go/UFIDA/',

    //同步pcsql数据库
    syncPgSql: 'https://iot.landiwulian.com/go/syncPgSql/',

    //应用的用户名和密码
    appAccount: 'iot_base_app_server_client:iotbaseappserverclient',
    //获取到的token
    loginToken: null,
    //用户信息
    userInfo: null,
    //用户权限
    authority: null,
    //小程序appid
    appId: wx.getAccountInfoSync().miniProgram.appId,
    //设备列表是否显示全部
    isShowNo: true,
    //应用id
    myAppId: 3,
    //是否显示帮助中心
    showHelp: false,
    //是否显示验证码登录
    showCodeLogin: false,
    //设备编码是否自行填写
    equipmentNoSelf: false,
    //是否显示设备报价单
    showPrice: false,
    //是否独立售后
    afterSaleSelf: true,
    //是否显示售后功能
    commonShowAfter: true,
    //定制主题
    theme: {
        //是否蓝涤
        default: true,
        //背景
        bg: '#036EB8',
        //按钮颜色
        btnBg: '#036EB8',
        //其他按钮颜色（主色调的对比色)
        otherBtn: '#E18C29'
    },
    //域名（为了报修时区分不同平台的请求来源）
    domainName: 'iot.landiwulian.com',
    //oss域名
    ossUrl: 'https://iot.landiwulian.com/oss/'
}

App({
    onLaunch: function () {
        //更新
        let um = wx.getUpdateManager()
        um.onCheckForUpdate(res => res.hasUpdate && um.onUpdateReady(() => um.applyUpdate()))

        //初始化配置
        this.initSet();
    },

    //初始化配置
    initSet() {
        let obj = {};

        //蓝涤（app.json设置标题navigationBarTitleText）
        if (globalDataPro.appId == 'wx4cdaaab2aa8a071c') {
            obj = {
                //logo
                logo: 'https://bangnizu.oss-cn-hangzhou.aliyuncs.com/zhandouli/logo/logo-landi2.png',
                //腾讯地图key（账号是满洋申请）
                tencentKey: 'MQZBZ-DBJKL-OPHPC-EHN2C-D4QW2-ICBLF',
                //是否显示绑定微信
                showBindWechat: true,
                //公众号名称
                officialName: '蓝涤物联'
            }
        }

        //伟顿物联（登录账号：佛山智科机器人）
        if (globalDataPro.appId == 'wx15cb856dc5681171') {
            obj = {
                //logo
                logo: 'http://bangnizu.oss-cn-hangzhou.aliyuncs.com/zhandouli/intelligentClean/logo_ele.png',
                //腾讯地图key
                tencentKey: 'WPBBZ-QZGE4-E33UV-DJNX5-JIXCH-O7FIB',
                //是否显示绑定微信
                showBindWechat: false,
                //公众号名称
                officialName: ''
            }
        }

        //合并对象
        Object.assign(globalDataPro, obj);
    },

    //生产环境
    globalData: globalDataPro
})